<?php

class Application_Form_StrankaEdit extends Zend_Form
{

    public function init()
    {
        /* Form Elements & Other Definitions Here ... */
        
        $this->setMethod('post');

        $this->addElement('text', 'ime', array(
            'label'      => 'Ime',
            'required'   => true,
            'class'      => 'form-control'
        ));

        $this->addElement('text', 'priimek', array(
            'label'      => 'Priimek',
            'required'   => true,
            'class'      => 'form-control'
        ));
        
        $this->addElement('text', 'email', array(
            'label'      => 'Email',
            'required'   => true,
            'class'      => 'form-control'
        ));
        
        $this->addElement('text', 'naslov', array(
            'label'      => 'Naslov',
            'required'   => true,
            'class'      => 'form-control'
        ));
        
        $this->addElement('text', 'telefon', array(
            'label'      => 'Telefon',
            'required'   => true,
            'class'      => 'form-control'
        ));

        $this->addElement('password', 'geslo', array(
            'label'      => 'Staro geslo',
            'required'   => true,
            'class'      => 'form-control'
        ));

        $this->addElement('checkbox', 'spremeni_geslo', array(
            'label'    => 'Spremeni geslo?',
            'required' => false,
            'class'      => 'form-control'
        ));

        $this->addElement('password', 'geslo_novo', array(
            'label'      => 'Novo geslo',
            'required'   => false,
            'class'      => 'form-control'
        ));

        $this->addElement('password', 'geslo_potrditev', array(
            'label'      => 'Potrditev gesla',
            'required'   => false,
            'class'      => 'form-control'
        ));

        $this->addElement('submit', 'submit', array(
            'label'    => 'Save',
            'class'      => 'form-control'
        ));

        $strankaSession = new Zend_Session_Namespace('Store_Stranke');
        $strankaModel = new Application_Model_Stranka();
        $strankaMapper = new Application_Model_StrankaMapper();
        $strankaMapper->find($strankaSession->strankaId, $strankaModel);

        $data = array("ime" => $strankaModel->getIme(), "priimek" => $strankaModel->getPriimek(),
            "email" => $strankaModel->getEmail(), "naslov" => $strankaModel->getNaslov(),
            "telefon" => $strankaModel->getTelefon()            
                );

        $this->setDefaults($data);

        $this->setAttrib('class', 'form-group');
        $this->setAttrib('id', 'new-stranka-form');
    }


}

